/*
This file is part of La Linea.

La Linea is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

La Linea is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with La Linea.  If not, see <http://www.gnu.org/licenses/>.
*/

#pragma once
#ifndef GLOBALS_H
#define GLOBALS_H

// Debug
#define _DEBUGMODE
// #define _FINDLEAKS

#ifndef _DEBUGMODE
	#define NDEBUG // Disable assertions
#else
	#ifdef _WIN32
	#ifdef _FINDLEAKS // Enable memory leaks research
		#include <stdlib.h>
		#include <crtdbg.h>
		#ifndef DEBUG_NEW
			#define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
			#define new DEBUG_NEW
		#endif // DEBUG_NEW
	#endif // _FINDLEAKS
	#endif // _WIN32
#endif // _DEBUGMODE

// Includes
#ifdef _WIN32
#include <Windows.h> // Do NOT move this include
#endif // _WIN32

#ifndef CALLBACK
#define CALLBACK
#endif // CALLBACK

#include <GL/glew.h>
#include <GL/glu.h>
#include <GL/glext.h>

#include <assert.h>
#include <stdlib.h>

#include <iostream>
#include <string>
#include <stdexcept>

// Macros
#define BUFFER_OFFSET(i) ((char *)NULL + (i))

// Flags
#define DRAW_CONTROLPOINTS 0x01
#define DRAW_ORIGINPOINTS  0x02
#define DRAW_CURVEPOINTS   0x04
#define DRAW_CURVELINE     0x08
#define DRAW_BORDERPOINTS  0x10
#define DRAW_BORDERLINE    0x20
#define DRAW_GHOST         0x40
#define DRAW_GRID          0x80
#define DRAW_NOCACHE       0x100
#define DRAW_NOCOLOR       0x200
#define DRAW_OSD		   0x400
#define DRAW_NOSTENCIL     0x800
#define DRAW_DEBUGSTENCIL  0x1000
#define DRAW_BOUNDINGBOX   0x2000

#define VIDEO_ANTIALIASING 0x01

// Some data structure (has to be moved)
struct simple2DVertex
{
   GLfloat x, y; 
};

struct textured2DVertex
{
	GLfloat x, y;
	GLfloat tx, ty;
};

// Global variables are dirty but I'm currently
// too lazy to use another way :o)
extern unsigned int quality;

#endif
